package com.vueperson.vueperson.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class VueConfig  implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        /**
         *     addMapping //设置允许跨域的路径
         *      allowedOrigins         //设置允许跨域请求的域名
         *         allowCredentials        //这里：是否允许证书 不再默认开启
         *          allowedMethods       //设置允许的方法
         *           maxAge      //跨域允许时间
         */


        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowedMethods("*")
                .allowCredentials(true)
                .maxAge(3600)
                .allowedHeaders("*");
    }


}
